package svc

import (
	"github.com/zeromicro/go-zero/core/stores/sqlx"
	"microdemo/internal/model/usermodel"
	"microdemo/service/user/internal/config"
)

type ServiceContext struct {
	Config config.Config
	// user 表对应 Model
	UserModel usermodel.UserModel
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config: c,
		// 注入 UserModel
		UserModel: usermodel.NewUserModel(sqlx.NewMysql(c.Mysql.DataSource)),
	}
}
